#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-02
@author: shell.xu
'''
import os, sys
import urllib2
import utils

sess = utils.Brower()

def testurl(url):
    try:
        sess.get(url)
        return 'passed: ' + url
    except urllib2.HTTPError, err:
        return 'failed: %s %s' % (url, str(err))

def autourl(hostname):
    print testurl('http://%s/atc/' % hostname)
    print testurl('http://%s/atc/user/shell' % hostname)
    print testurl('http://%s/usr/' % hostname)
    print testurl('http://%s/usr/show/shell' % hostname)

def main():
    hostname = '127.0.0.1:8080'
    if len(sys.argv) > 1: hostname = sys.argv[1]
    autourl(hostname)

if __name__ == '__main__': main()
